for _ in range(int(input())):
n = int(input())
numbers = list(map(int, input().split()))
sequence = []
for i in range(n):
_, bi = input().split()
for act in bi:
if act == 'D':
numbers[i] += 1
else:
numbers[i] -= 1
numbers[i] %= 10
print(*numbers)
#include<iostream>
using namespace std;
int main() {
int tc;
scanf("%d", &tc);
while(tc--) {
int n;
scanf("%d", &n);
int currentPositions[n];
for(int i=0; i<n; i++){
scanf("%d", ¤tPositions[i]);
}
int b; string sequence;
for(int i=0; i<n; i++) {
scanf("%d", &b);
cin >> sequence;
for(int j=0; j<b; j++) {
if(sequence[j] == 'U') {
currentPositions[i]--;
} else if(sequence[j] == 'D') {
currentPositions[i]++;
}
if(currentPositions[i] == -1) {
currentPositions[i] = 9;
}
currentPositions[i] %= 10;
}
}
for(int i=0; i<n; i++) {
printf("%d ", currentPositions[i]);
}
printf("\n");
}
return 0;
}
664A - Complicated GCD | 1635D - Infinite Set |
1462A - Favorite Sequence | 1445B - Elimination |
1656C - Make Equal With Mod | 567A - Lineland Mail |
1553A - Digits Sum | 1359B - New Theatre Square |
766A - Mahmoud and Longest Uncommon Subsequence | 701B - Cells Not Under Attack |
702A - Maximum Increase | 1656D - K-good |
1426A - Floor Number | 876A - Trip For Meal |
1326B - Maximums | 1635C - Differential Sorting |
961A - Tetris | 1635B - Avoid Local Maximums |
20A - BerOS file system | 1637A - Sorting Parts |
509A - Maximum in Table | 1647C - Madoka and Childish Pranks |
689B - Mike and Shortcuts | 379B - New Year Present |
1498A - GCD Sum | 1277C - As Simple as One and Two |
1301A - Three Strings | 460A - Vasya and Socks |
1624C - Division by Two and Permutation | 1288A - Deadline |